<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $model \app\models\UserAr */
/* @var $checkAccess */
?>

<div class="row">
    <div class="col-md-12">

        <?php $form = ActiveForm::begin([
            'options' => ['class' => 'form-horizontal'],
            'fieldConfig' => [
                'template' => "{label}\n<div class=\"col-md-4\">{input}\n{error}</div>",
                'labelOptions' => ['class' => 'col-md-3 control-label']
            ]
        ]); ?>

        <?= $form->field($model, 'username')->textInput(array_merge(['maxlength' => TRUE], $model->isNewRecord ? [] : ['readonly' => 'readonly'])); ?>

        <?php if($model->isNewRecord): ?>
        <?= $form->field($model, 'gid')->dropDownList(\app\models\UserAr::$groupLabels); ?>
        <?php endif; ?>

        <?php if ($model->isNewRecord): ?>
            <?= $form->field($model, 'password')->passwordInput(['maxlength' => TRUE]); ?>
            <?= $form->field($model, 'password2')->passwordInput(['maxlength' => TRUE]); ?>
        <?php else: ?>
            <?= $form->field($model, 'newPwd')->passwordInput(['placeholder' => '不修改请留空', 'maxlength' => TRUE]); ?>
            <?= $form->field($model, 'newPwd2')->passwordInput(['placeholder' => '不修改请留空', 'maxlength' => TRUE]); ?>
        <?php endif; ?>

        <?= $form->field($model, 'nickname')->textInput(['maxlength' => TRUE]); ?>

        <?= $form->field($model, 'email')->textInput(['maxlength' => TRUE]); ?>

        <?= $form->field($model, 'status')->dropDownList(\app\models\UserAr::$statusLabels); ?>

        <div class="form-group">
            <div class="col-md-4 col-md-offset-3">
                <?= Html::submitButton($this->params['page-title'], ['class' => 'btn btn-block ladda-button', 'data-style'=>'zoom-in']) ?>
            </div>
        </div>

        <?php ActiveForm::end(); ?>
    </div>
</div>
